package edu.sctu.zhoudie.mouth201505.day20150529.others;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by user08 on 2015/5/29.
 */
public class TextOne extends TextMore {
    public void getTercherInfo(){

        List<Teacher> list = sotrNumber();

        for (int i = 0; i < list.size(); i++) {
            System.out.println("******"+list.get(i).getName()+"******");
            System.out.println("工号："+list.get(i).getNumber()+"\t职称："+list.get(i).getTitle()+"\t性别："+list.get(i).getSex()+"\t课程："+list.get(i).getLesson());
            System.out.println("******"+list.get(i).getName()+"******");
            System.out.println("所教学生：");

            for (int j = 0; j < list.get(i).getStudent().size(); j++) {
                System.out.println("\t"+list.get(i).getStudent().get(j).getName());
            }

        }


    }

    public List<Student> getStudent(int code,List<Student> list){
        List<Student> list1 = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getGradle()>code){
                list1.add(list.get(i));
            }
        }
        return list1;
    }

    public void getCode(){

        List<Teacher> listT = pritCoded();

        List<Student> listS = new ArrayList<>();

        for (int i = 0; i < listT.size(); i++) {
            listS = listT.get(i).getStudent();
        }

        MyInterface inter = new MyInterface() {
            @Override
            public void method(List<Student> list) {
                List<Student> list1 = getStudent(75,list);
                System.out.println("教授下成绩大于"+75+"的学生：");
                for (int i = 0; i < list1.size(); i++) {


                    System.out.print(list1.get(i).getName() + "\t");
                }

            }
        };
        inter.method(listS);

    }

    public void getcourse(){
        List<Student> StudentList = sortStudent();
        List<List>  ListAll = new ArrayList<List>();
        List  ListAllaccord = new ArrayList<>();

        List  ListChinese = new ArrayList<>();
        List  ListMath = new ArrayList<>();
        List  ListEnglish = new ArrayList<>();
        List  ListChemistry = new ArrayList<>();
        List  ListPhysics = new ArrayList<>();
        List  ListBiology = new ArrayList<>();
        List  ListHistory = new ArrayList<>();

        ListAll.add(ListChinese);
        ListAll.add(ListMath);
        ListAll.add(ListEnglish);
        ListAll.add(ListChemistry);
        ListAll.add(ListPhysics);
        ListAll.add(ListBiology);
        ListAll.add(ListHistory);

        ListChinese.add("语文");
        ListMath.add("数学");
        ListEnglish.add("英语");
        ListBiology.add("生物");
        ListHistory.add("历史");
        ListPhysics.add("物理");
        ListChemistry.add("化学");


        for (int i = 0; i < StudentList.size(); i++) {

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "语文")
                    ListChinese.add(StudentList.get(i).getName());
            }

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "数学")
                    ListMath.add(StudentList.get(i).getName());
            }

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "英语")
                    ListEnglish.add(StudentList.get(i).getName());
            }

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "化学")
                    ListChemistry.add(StudentList.get(i).getName());
            }

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "生物")
                    ListBiology.add(StudentList.get(i).getName());
            }

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "物理")
                    ListPhysics.add(StudentList.get(i).getName());
            }

            for (int j = 0; j < StudentList.get(i).getCourse().size(); j++) {

                if (StudentList.get(i).getCourse().get(j) == "历史")
                    ListHistory.add(StudentList.get(i).getName());
            }
        }



        int x = Math.max(ListBiology.size(),Math.max(ListChemistry.size(),Math.max(ListChinese.size(),Math.max(ListEnglish.size(),Math.max(ListHistory.size(),Math.max(ListMath.size(), ListPhysics.size()))))));

        for (int i = 0; i < ListAll.size(); i++) {
            if(ListAll.get(i).size()==x)
                ListAllaccord.add(ListAll.get(i));
        }

        for (int i = 0; i < ListAllaccord.size(); i++) {
            System.out.println("所选课程最多的是："+ListAllaccord.get(i));
        }

    }

}
